-- phpMyAdmin SQL Dump
-- version 3.4.5
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Dec 08, 2011 at 12:22 PM
-- Server version: 5.5.16
-- PHP Version: 5.3.8

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `amxxxx`
--
create database amxxxx;
use amxxxx;
-- --------------------------------------------------------

--
-- Table structure for table `award`
--

CREATE TABLE IF NOT EXISTS `award` (
  `aw_month` char(2) NOT NULL,
  `aw_year` char(20) NOT NULL,
  `recipe_AA` int(10) NOT NULL,
  `recipe_username` varchar(20) NOT NULL,
  `prize` varchar(25) NOT NULL DEFAULT 'unknown',
  PRIMARY KEY (`aw_month`,`aw_year`),
  KEY `recipe_AA` (`recipe_AA`,`recipe_username`)
) ENGINE=InnoDB DEFAULT CHARSET=greek;

--
-- Dumping data for table `award`
--

INSERT INTO `award` (`aw_month`, `aw_year`, `recipe_AA`, `recipe_username`, `prize`) VALUES
('1', '2011', 1, 'antonia123', 'most innovative recipe'),
('11', '2011', 5, 'masterchef2', 'most delicious recipe'),
('2', '2010', 7, 'peter22', '20min to eat'),
('3', '2010', 4, 'antonia123', 'best italian recipe'),
('4', '2010', 8, 'peter22', 'gourmet of the month'),
('7', '2010', 6, 'antonia123', 'best dessert');

-- --------------------------------------------------------

--
-- Table structure for table `category`
--

CREATE TABLE IF NOT EXISTS `category` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(20) NOT NULL DEFAULT 'unknown',
  `fid` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fid` (`fid`)
) ENGINE=InnoDB  DEFAULT CHARSET=greek AUTO_INCREMENT=22 ;

--
-- Dumping data for table `category`
--

INSERT INTO `category` (`id`, `title`, `fid`) VALUES
(1, 'elliniki_kouzina', NULL),
(2, 'mageiriki', 1),
(3, 'zaxaroplastiki', 1),
(4, 'auga_turi', 2),
(5, 'laxanika', 2),
(6, 'psaria_thalassina', 2),
(7, 'poulerika', 2),
(8, 'kreas', 2),
(9, 'ruzi', 2),
(10, 'zumarika', 2),
(11, 'patates', 2),
(12, 'tourtes_pastes', 3),
(13, 'suropiasta', 3),
(14, 'mpiskota', 3),
(15, 'tsourekia', 3),
(16, 'italikh kouzina', NULL),
(18, 'me3ikanikh kouzina', NULL),
(19, 'kinezikh kouzina', NULL),
(20, 'umbria', 16),
(21, 'calabria', 16);

-- --------------------------------------------------------

--
-- Table structure for table `contains`
--

CREATE TABLE IF NOT EXISTS `contains` (
  `recipe_AA` int(10) NOT NULL,
  `recipe_username` varchar(20) NOT NULL,
  `ingr_id` int(11) NOT NULL AUTO_INCREMENT,
  `quantity` varchar(255) NOT NULL,
  PRIMARY KEY (`recipe_AA`,`recipe_username`,`ingr_id`),
  KEY `ingr_id` (`ingr_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=greek AUTO_INCREMENT=36 ;

--
-- Dumping data for table `contains`
--

INSERT INTO `contains` (`recipe_AA`, `recipe_username`, `ingr_id`, `quantity`) VALUES
(1, 'antonia123', 1, '25g'),
(1, 'antonia123', 3, '2g'),
(1, 'antonia123', 6, '200g'),
(1, 'antonia123', 7, '2g'),
(1, 'antonia123', 8, '10ml'),
(2, 'masterchef2', 25, '2kg zaxari'),
(2, 'masterchef2', 26, '3lt nero'),
(2, 'masterchef2', 27, '1 paketo'),
(2, 'masterchef2', 28, '1kg 3iroi karpoi'),
(2, 'masterchef2', 29, '20 garufalla'),
(2, 'masterchef2', 30, '500g bouturo'),
(4, 'antonia123', 1, '100ml'),
(4, 'antonia123', 2, '4g'),
(4, 'antonia123', 3, '3g'),
(4, 'antonia123', 12, '1 mikro kremmudi'),
(4, 'antonia123', 18, '1 paketo'),
(4, 'antonia123', 19, '1 koutaki'),
(4, 'antonia123', 20, '1 skelida'),
(4, 'antonia123', 26, '1 katsarola'),
(5, 'masterchef2', 16, '2 patates'),
(5, 'masterchef2', 26, '1 katsarola'),
(5, 'masterchef2', 32, '2 karota'),
(5, 'masterchef2', 33, '2 kolokuthia'),
(5, 'masterchef2', 34, '1kg psari'),
(5, 'masterchef2', 35, '100g selino'),
(6, 'antonia123', 21, '4 pantespania'),
(6, 'antonia123', 22, '0,5kg marmelada'),
(6, 'antonia123', 23, '100g kerasia'),
(6, 'antonia123', 24, '500g koubertoura'),
(6, 'antonia123', 28, '100g 3irous karpous'),
(7, 'peter22', 1, '30ml'),
(7, 'peter22', 2, '3g'),
(7, 'peter22', 3, '3g'),
(7, 'peter22', 4, '3g'),
(7, 'peter22', 31, '4 brizoles');

-- --------------------------------------------------------

--
-- Table structure for table `editor`
--

CREATE TABLE IF NOT EXISTS `editor` (
  `username` varchar(20) NOT NULL,
  `biography` text,
  PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=greek;

--
-- Dumping data for table `editor`
--

INSERT INTO `editor` (`username`, `biography`) VALUES
('antonia123', 'den exei kanei tipota a3iologo.genni8ike stin patra.'),
('masterchef1', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas leo tellus, pellentesque sit amet molestie eu, venenatis nec tellus. Curabitur ac consectetur massa. '),
('masterchef2', 'Gennithike ston Peiraia.Gios karabomageira ekane dipla ston patera tou ta prwta tou bimata stis kouzines twn karabiwn.Mazi tou agapise ti thalassa,ta taxidia kai ti mageiriki.Apo neari ilikia taxideue,gnwrizontas geuseis apo diafores kouzines tou kosmou. To 1987 dimiourgise to diko tou estiatorio pou einai to prwto me ellina chef pou katektise asteri Michelin,to simantikotero brabeio mageirikis ston kosmo'),
('papadop3', 'Suspendisse potenti. Cras interdum nibh nec augue aliquet sed condimentum dolor tempor. Nunc volutpat dignissim neque vel feugiat. '),
('peter22', 'Gennithike stin Athina.Se ilikia 18 etwn pige stin Ameriki opou spoudase oikonomika sto UCLA kai katopin foitise stin Culinary Institute of Amerika.Apo to 1993 xekinise ta prwta tou epaggelmatika bimata kai apo to 1996 arxise na ergazetai se megala xenodoxeia kai estiatoria stin ameriki.Apo to 2005 einai chef se krhtiko estiatorio pou exei brabeuthei me xruso skoufo kai me brabeia Gourmet');

-- --------------------------------------------------------

--
-- Table structure for table `ingredient`
--

CREATE TABLE IF NOT EXISTS `ingredient` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `description` text,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=greek AUTO_INCREMENT=36 ;

--
-- Dumping data for table `ingredient`
--

INSERT INTO `ingredient` (`id`, `description`) VALUES
(1, 'ladi'),
(2, 'alati'),
(3, 'piperi'),
(4, 'rigani'),
(5, 'thymari'),
(6, 'turi'),
(7, 'boukobo'),
(8, 'ouzo'),
(9, 'ntomata'),
(10, 'aggouri'),
(11, 'piperia'),
(12, 'kremmudi'),
(13, 'feta'),
(14, 'krema galaktos'),
(15, 'bacon'),
(16, 'patates'),
(17, 'turi trimmeno'),
(18, 'makaronia'),
(19, 'pummaro'),
(20, 'skordo'),
(21, 'pantespani'),
(22, 'marmelada kerasi'),
(23, 'freska kerasia'),
(24, 'koubertoura'),
(25, 'zaxari'),
(26, 'nero'),
(27, 'fullo kroustas'),
(28, 'ksiroi karpoi'),
(29, 'garufallo'),
(30, 'bouturo'),
(31, 'brizola xoirini'),
(32, 'karota'),
(33, 'koloku8ia'),
(34, 'psari'),
(35, 'selino');

-- --------------------------------------------------------

--
-- Table structure for table `rating`
--

CREATE TABLE IF NOT EXISTS `rating` (
  `recipe_AA` int(10) NOT NULL,
  `recipe_username` varchar(20) NOT NULL,
  `user_username` varchar(20) NOT NULL,
  `grade` int(11) NOT NULL,
  `reg_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`recipe_AA`,`recipe_username`,`user_username`),
  KEY `user_username` (`user_username`)
) ENGINE=InnoDB DEFAULT CHARSET=greek;

--
-- Dumping data for table `rating`
--

INSERT INTO `rating` (`recipe_AA`, `recipe_username`, `user_username`, `grade`, `reg_time`) VALUES
(1, 'antonia123', 'peter22', 6, '2011-01-30 11:10:00'),
(2, 'masterchef2', 'masterchef1', 10, '2011-11-23 09:17:00'),
(2, 'masterchef2', 'peter22', 4, '2011-07-15 16:45:00'),
(4, 'antonia123', 'masterchef1', 7, '2011-05-05 14:14:00'),
(5, 'masterchef2', 'peter22', 9, '2011-09-07 18:05:00'),
(6, 'antonia123', 'masterchef1', 8, '2011-06-15 15:39:00'),
(6, 'antonia123', 'peter22', 2, '2011-07-18 20:11:00'),
(7, 'peter22', 'antonis1990', 7, '2011-12-11 08:13:00'),
(7, 'peter22', 'papadop2', 9, '2011-08-09 17:55:00');

-- --------------------------------------------------------

--
-- Table structure for table `recipe`
--

CREATE TABLE IF NOT EXISTS `recipe` (
  `AA` int(10) NOT NULL,
  `username` varchar(20) NOT NULL,
  `title` varchar(20) NOT NULL,
  `description` text,
  `prescription` text,
  `portions` int(11) NOT NULL,
  `kcal` int(11) NOT NULL,
  `preparation_time` varchar(10) NOT NULL,
  `cook_time` varchar(10) NOT NULL,
  `reg_date_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `cat_id` int(11) NOT NULL,
  PRIMARY KEY (`AA`,`username`),
  KEY `username` (`username`),
  KEY `cat_id` (`cat_id`)
) ENGINE=InnoDB DEFAULT CHARSET=greek;

--
-- Dumping data for table `recipe`
--

INSERT INTO `recipe` (`AA`, `username`, `title`, `description`, `prescription`, `portions`, `kcal`, `preparation_time`, `cook_time`, `reg_date_time`, `cat_id`) VALUES
(1, 'antonia123', 'saganaki', 'turi sto tigani me diafora murodika polu geustiko kai eukolo dokimaste to', 'xrisimopoioume ena tigani to opoio to exoume alleipsei me ladi,to bazoume sto mati tis kouzinas,exoume kopsei ena kommati kitrino imiskliro turi tis areskeias mas(emeis epilegoume to mege8os arkei na exei paxos 1-1,5 daxtulo),molis zesta8ei arketa rixnoume to turi sto tigani,sti sunexeia rixoume ligo piperi kai ligo boukobo,to afinoume gia 5 lpt kai to trabame apo to mati, enw einai kauto rixnoume ena sfinaki ouzo kai to anaboume me anaptira(to afinoume na sbisei mono tou', 4, 100, '5min', '5min', '2011-11-01 22:00:00', 4),
(1, 'papadop3', 'Guacamole', 'Guacamole was made by the Aztecs as early as the 16th century', NULL, 12, 560, '20m', '50m', '2011-12-08 12:20:30', 18),
(2, 'masterchef2', 'mpaklabas', 'to paradosiako elliniko gluko isws to pio geustiko kai tautoxrona to pio duskolo gluko tapsiou', 'pairnoume fullo kroustas ena tapsi to aleifoume me bouturo kai bazoume fullo kai karudi(i oti allo 3uro karpo 8elei o ka8enas kai kanoume strwseis.to psinoume,enw meta to spisimo to koboume xiasti kai bazoume se ka8e kommati ena garufalo fiaxnoume siropi apo zaxari kai nero kai afou kopsoume to psimeno baklaba rixnoume to siropi sta tapsi mexri na to piei to gluko', 20, 150, '1h', '2-2,5h', '2011-10-18 12:34:16', 13),
(3, 'papadop3', 'fajitas', 'Nullam risus odio, mattis posuere sagittis ut, semper eget nisl. Sed vulputate sapien sem, vitae aliquet purus.', 'Aliquam consequat pulvinar porttitor. In iaculis nulla nec justo ultrices bibendum. Sed ullamcorper, lacus in facilisis placerat, sapien nisi viverra neque, id consectetur orci nulla ut tortor. ', 3, 220, '35m', '40m', '2011-12-08 08:18:09', 18),
(4, 'antonia123', 'makaronia napoliten', 'apli kai eukoli suntagi gia makaronia me kokkini saltsa', 'pairnoume mia katsarola ti gemizoume nero kai ti bazoume sto mati mexri na brasei to nero sti sunexia rixnoume ta makaronia kai ta afinoume mesa gia 10 lpt ta sourwnouume meta kai etoima ta makaronia, Gia ti saltsa 8a paroume ena katsarolaki 8a ri3oume ligo ladi 8a tsigarizoume ena mikro kremidi afou to psilokopsoume kai 1 megali skelida skordo meta rixnoume to pummaro rixnoume alati piperi ligo ladaki akoma kai afinoume na se xamili fwtia gia 20 lpt', 4, 110, '15min', '40min', '2011-12-07 13:33:31', 10),
(5, 'masterchef1', 'spanakoruzo', 'Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec vitae felis lacus. Praesent ac diam ut tellus scelerisque fringilla eu nec arcu. ', 'Aliquam lorem odio, accumsan ut eleifend ac, pulvinar ac mi. Etiam tristique convallis lacinia. ', 3, 120, '40m', '40m', '2011-12-08 12:21:58', 1),
(5, 'masterchef2', 'psarosoupa', 'gia tous latreis tis 8alassas i pio apli suntagi psarosoupas', 'pairnoume mia katsarola ti gemizoume nero kai rixoume mesa 2 megales patates psilokomenes 2 karota kommena kai 2 koloku8ia kommena kai selino ta brazoume me ta bgazoume apo tin katsarola kai kratame oso nero xreiazete gia na kalufei to psari pou pirame guro sto kilo kai kati to brazoume kai rixnoume ta perissotera apo ta laxanika pou brasame pisw stin katsarola ta upoloipa ta liwnoume sto blender kai ta rixnoume kai auta mesa', 4, 90, '20min', '1h', '2011-12-07 13:33:22', 6),
(6, 'antonia123', 'tourta blackforest', 'tourta me kerasia kai sokolata duskolo alla to apotelesma 8a sas sunarpasei', 'fiaxnoume pantespani pernoume marmelada kerasi pairnoume kai koubertoura kai fiaxnoume strwseis pantespani marmelada koubertoura liwmeni kai sto telos to louzoume kai me koubertoura liwmeni apo panw kai gia decor rixnoume kai merika freska kerasia kai 3irous karpous apo panw', 8, 220, '20min', '40lpt', '2011-12-07 13:33:16', 12),
(7, 'peter22', 'mprizoles xoirines', 'eukolo-geustiko kai panw apo ola fagito pou 8a se kratisei', 'pairnoume 4 brizoles afou exoume pro8ermanei ena tiganei pou to exoume aleipsei me ladi bazoume tis brizoles mesa kai rixnoume allati piperi rigani kai perimenoume na psi8oun gia kana 20lpt', 4, 150, '10min', '20-25min', '2011-12-07 13:35:30', 8),
(8, 'peter22', 'carpaccio', 'i pio apli suntagi ', 'bla bla bla', 2, 700, '15m', '3m', '2011-12-07 13:36:05', 16);

-- --------------------------------------------------------

--
-- Table structure for table `user`
--

CREATE TABLE IF NOT EXISTS `user` (
  `username` varchar(20) NOT NULL,
  `password` varchar(10) NOT NULL,
  `name` varchar(30) NOT NULL DEFAULT 'unknown',
  `surname` varchar(30) NOT NULL DEFAULT 'unknown',
  `birthdate` date NOT NULL,
  PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=greek;

--
-- Dumping data for table `user`
--

INSERT INTO `user` (`username`, `password`, `name`, `surname`, `birthdate`) VALUES
('antonia123', 'passwo', 'Antonia', 'Papadopoulou', '2000-05-28'),
('antonis1990', 'asdfgh', 'Antonis', 'Kontos', '1993-05-28'),
('masterchef1', 'suidfos', 'Maria', 'Kuparissi', '1992-01-01'),
('masterchef2', 'kritis2', 'Lefteris', 'Lazarou', '1965-11-02'),
('papadop1', '123qwer', 'Kwstas', 'Papadopoulos', '1983-11-01'),
('papadop2', '3214rt', 'Nikos', 'Papadopoulos', '1987-12-02'),
('papadop3', 'zxcvbn', 'Giwrgos', 'Papadopoulos', '1977-01-01'),
('peter22', 'tset1', 'Andreas', 'Petrakos', '1978-11-02');

--
-- Constraints for dumped tables
--

--
-- Constraints for table `award`
--
ALTER TABLE `award`
  ADD CONSTRAINT `award_ibfk_1` FOREIGN KEY (`recipe_AA`, `recipe_username`) REFERENCES `recipe` (`AA`, `username`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `category`
--
ALTER TABLE `category`
  ADD CONSTRAINT `category_ibfk_1` FOREIGN KEY (`fid`) REFERENCES `category` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `contains`
--
ALTER TABLE `contains`
  ADD CONSTRAINT `contains_ibfk_1` FOREIGN KEY (`recipe_AA`, `recipe_username`) REFERENCES `recipe` (`AA`, `username`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `contains_ibfk_2` FOREIGN KEY (`ingr_id`) REFERENCES `ingredient` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `editor`
--
ALTER TABLE `editor`
  ADD CONSTRAINT `editor_ibfk_1` FOREIGN KEY (`username`) REFERENCES `user` (`username`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `rating`
--
ALTER TABLE `rating`
  ADD CONSTRAINT `rating_ibfk_1` FOREIGN KEY (`recipe_AA`, `recipe_username`) REFERENCES `recipe` (`AA`, `username`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `rating_ibfk_2` FOREIGN KEY (`user_username`) REFERENCES `user` (`username`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `recipe`
--
ALTER TABLE `recipe`
  ADD CONSTRAINT `recipe_ibfk_1` FOREIGN KEY (`username`) REFERENCES `editor` (`username`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `recipe_ibfk_2` FOREIGN KEY (`cat_id`) REFERENCES `category` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
